package com.android.mybase.utils

import android.annotation.SuppressLint
import android.view.View

@SuppressLint("DefaultLocale")
fun Int.toFormat(step : Float = 1000f, unit: String = "k"): String {
    return if (this >= step) {
        val formattedValue = this / step
        if (formattedValue % 1 == 0f) {
            "${formattedValue.toInt()}unit"
        } else {
            String.format("%.1f$unit", formattedValue)
        }
    } else {
        "$this"
    }
}

fun View.visible() { visibility = View.VISIBLE }
fun View.gone() { visibility = View.GONE }
fun View.invisible() { visibility = View.INVISIBLE }
